<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/18
 * Time: 22:50
 */

namespace app\index\model;


use think\Model;
use think\Db;
class TripCateModel extends Model
{
    protected $name = 'trip_cate';

    public  function getTripCate(){
        $main_cate = $this->where('pid',0)->select();

        foreach($main_cate as &$val)
        {
//            var_dump($val);

            $val['sub_category'] = $this->where('pid',$val->id)->select();
        }

        return $main_cate;
    }
}